<?php
declare (strict_types = 1);

namespace app\validate;

use think\Validate;

class Contact extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'nickname' => 'require',
        'userid' => 'require',
        'typeid' => 'require',
        'phone' => 'number|max:11',
        'gender' => 'number|in:0,1,2',
        'region' => 'number',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'nickname.require' => '昵称必填',
        'userid.require' => '用户id必填',
        'typeid.require' => '分类id必填',
        'phone.require' => '手机号必填',
        'gender.require' => '性别必填',
        'region.require' => '地区码必填'
    ];
}
